package com.forum.service.Impl;

import com.forum.dao.AdminDaoMapper;
import com.forum.dao.AuditDaoMapper;
import com.forum.pojo.Audit;
import com.forum.service.AuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service("AuditService")
public class AuditServiceImpl implements AuditService {
    @Autowired
    private AuditDaoMapper auditDaoMapper;
    @Override
    public int saveAudit(String administratorID,String messageID, String auditStatus) {
        Audit audit = new Audit();
        audit.setAdministratorID(administratorID);
        audit.setMessageID(messageID);
        audit.setAuditStatus(auditStatus);
        Date date = new Date(System.currentTimeMillis());
        audit.setAuditDate(date);
        return auditDaoMapper.saveAudit(audit);
    }

    @Override
    public List<Audit> findAudit() {
        return auditDaoMapper.findAudit(new Audit());
    }
}
